package com.traffic.util;


import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;

import java.util.ArrayList;
import java.util.List;
@Component
@Slf4j
public class TrajectoryUtil {


    //数据库读取轨迹点转化为list
    // x1,y1|x2,y2|x3,y3

    public List<List<Double>> pointsConvert(String points){

        List<List<Double>> lists = new ArrayList<>();
        String[] pointsOne = points.split("|");


        for (String point:pointsOne) {

            String[] LngAndLatStr = point.split(",");

            List<Double> LngAndLatList = new ArrayList<>();

            LngAndLatList.add(new Double(LngAndLatStr[0]));
            LngAndLatList.add(new Double(LngAndLatStr[1]));

            lists.add(LngAndLatList);

        }
        return lists;

    }

    public String pointsToStr(String points){

        return "temp";
    }


}
